﻿/***********************************************************************
 * <copyright file="Role.cs" company="B/S JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoang Bich Son 
 * Email:    sonhb@newman.vn
 * Website:
 * Create Date: Sunday, March 23, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System.Collections.Generic;
using BusinessObjects;
using BusinessObjects.BusinessRules;

namespace BusinessSecurity
{
    /// <summary>
    ///     Role
    /// </summary>
    public class Role : BusinessObject
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="Role" /> class.
        /// </summary>
        public Role()
        {
            AddRule(new ValidateId("RoleId"));
            AddRule(new ValidateLength("RoleName", 0, 255));
        }

        public Role(int roleId, string title, string roleName, string description, bool isActive, List<RoleInSite> roleInSites)
            : this()
        {
            RoleId = roleId;
            Title = title;
            RoleName = roleName;
            Description = description;
            IsActive = isActive;
            RoleInSites = roleInSites;
        }

        /// <summary>
        ///     Gets or sets the role identifier.
        /// </summary>
        /// <value>
        ///     The role identifier.
        /// </value>
        public int RoleId { get; set; }

        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>
        /// The title.
        /// </value>
        public string Title { get; set; }

        /// <summary>
        ///     Gets or sets the name of the role.
        /// </summary>
        /// <value>
        ///     The name of the role.
        /// </value>
        public string RoleName { get; set; }

        /// <summary>
        ///     Gets or sets the description.
        /// </summary>
        /// <value>
        ///     The description.
        /// </value>
        public string Description { get; set; }

        /// <summary>
        ///     Gets or sets a value indicating whether [is active].
        /// </summary>
        /// <value>
        ///     <c>true</c> if [is active]; otherwise, <c>false</c>.
        /// </value>
        public bool IsActive { get; set; }

        /// <summary>
        /// Gets or sets the role in sites.
        /// </summary>
        /// <value>
        /// The role in sites.
        /// </value>
        public List<RoleInSite> RoleInSites { get; set; }
    }
}